package server;

import Constans.Constants;
import bean.HotVideo;
import bean.HotVideoComm;
import com.alibaba.fastjson.JSONObject;
import request.HttpUtil;

import java.util.List;

/**
 * @author:zhengyilong
 * @email:1797344574@qq.com
 * @phone:13479394730
 * @desc:
 * @DateTime:2021/12/6 20:00
 **/
public class HotVideoService {
    //该方法用于获取热门数据，并将热门数据返回
    public static List<HotVideo> getHotVideo(){
        //http://apis.juhe.cn/fapig/douyin/billboard?key=&type=travel_overall
        String url = Constants.TRIP_URL
                + "?key=" +Constants.TRIP_KEY
                + "&type=hot_video"
                + "&size=20";
        String result = HttpUtil.get(url);
        //json解析
        HotVideoComm videoComm = JSONObject.parseObject(result, HotVideoComm.class);
        return videoComm.getResult();
    }
}

